Array.prototype.equals = function(other) {
	if (typeof(other) !== 'object' || typeof(other.length) === 'undefined' || other.length !== this.length) {
		return false;
	}
	
	for (var i = 0; i < this.length; i++) {
		if (this[i] !== other[i]) {
			return false;
		}
	}
	
	return true;
}

Array.prototype.contains = function(o) {
	for (var i=0; i < this.length; i++) {
		if (this[i] === o) {
			return true;
		}
	}
	
	return false;
	
}

Array.prototype.indexOf = function(o) {
	var index = -1;
	
	for (var i = 0; i < this.length; i++) {
		if (this[i] === o) {
			index = i;
			break;
		}
	}
	
	return index;
}


String.prototype.words = function() {
	var words = this.split(" ");
	
	return words;
}

String.prototype.subphrases = function(length) {
	var words = this.words();
	var subsets = words.subsets(length);
	var results = [];
	
	$(subsets).each(function(i,subset){
		results.push(subset.join(" "));
	});
}

String.prototype.wordsCount = function() {
	return this.words().length;
}